package com.charity.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class CommonResponse {

    public static final String OK = "200";

    private String code;
    private String message;
    private Object data;

    public CommonResponse ok(Object data){
        return new CommonResponse(OK, "SUCCESS",data);
    }

    public CommonResponse fail(String code, Exception ex){
        return new CommonResponse(code, ex.getMessage(), null);
    }

    public CommonResponse cuw(String code, String message){
        return new CommonResponse(code, message, null);
    }
}
